home *** CD-ROM | disk | FTP | other *** search
open in:
MacOS 8.1
|
Win98
|
DOS
browse contents |
view JSON data
|
view as text
This file was processed as: LaTeX Document
(document/latex).
Confidence | Program | Detection | Match Type | Support
|
---|
100%
| dexvert
| LaTeX Document (document/latex)
| magic
| Supported |
1%
| dexvert
| Corel 10 Texture (image/corel10Texture)
| ext
| Unsupported |
1%
| dexvert
| Text File (text/txt)
| fallback
| Supported |
100%
| file
| LaTeX document text
| default
| |
99%
| file
| C source text
| default
| |
98%
| file
| C source, ASCII text
| default
| |
100%
| checkBytes
| Printable ASCII
| default
| |
100%
| perlTextCheck
| Likely Text (Perl)
| default
| |
100%
| siegfried
| fmt/281 LaTeX (Subdocument)
| default
| |
100%
| detectItEasy
| Format: Plain text[LF]
| default
|
|
hex view+--------+-------------------------+-------------------------+--------+--------+
|00000000| 5c 61 75 74 68 6f 72 20 | 7b 53 76 65 6e 20 47 6f |\author |{Sven Go|
|00000010| 6c 64 74 7d 0a 5c 74 69 | 74 6c 65 20 7b 54 68 65 |ldt}.\ti|tle {The|
|00000020| 20 4c 69 6e 75 78 20 50 | 72 6f 67 72 61 6d 6d 65 | Linux P|rogramme|
|00000030| 72 27 73 20 47 75 69 64 | 65 7d 0a 5c 63 68 61 70 |r's Guid|e}.\chap|
|00000040| 74 65 72 20 7b 53 79 73 | 74 65 6d 20 63 61 6c 6c |ter {Sys|tem call|
|00000050| 73 7d 0a 0a 20 41 20 73 | 79 73 74 65 6d 20 63 61 |s}.. A s|ystem ca|
|00000060| 6c 6c 20 69 73 20 75 73 | 75 61 6c 6c 79 20 61 20 |ll is us|ually a |
|00000070| 72 65 71 75 65 73 74 20 | 74 6f 20 74 68 65 20 6f |request |to the o|
|00000080| 70 65 72 61 74 69 6e 67 | 20 73 79 73 74 65 6d 20 |perating| system |
|00000090| 28 6b 65 72 6e 65 6c 29 | 20 74 6f 0a 20 64 6f 20 |(kernel)| to. do |
|000000a0| 61 20 68 61 72 64 77 61 | 72 65 2f 73 79 73 74 65 |a hardwa|re/syste|
|000000b0| 6d 2d 73 70 65 63 69 66 | 69 63 20 6f 72 20 70 72 |m-specif|ic or pr|
|000000c0| 69 76 69 6c 65 67 65 64 | 20 6f 70 65 72 61 74 69 |ivileged| operati|
|000000d0| 6f 6e 2e 20 20 41 73 20 | 6f 66 0a 20 4c 69 6e 75 |on. As |of. Linu|
|000000e0| 78 2d 31 2e 32 2c 20 31 | 34 30 20 73 79 73 74 65 |x-1.2, 1|40 syste|
|000000f0| 6d 20 63 61 6c 6c 73 20 | 68 61 76 65 20 62 65 65 |m calls |have bee|
|00000100| 6e 20 64 65 66 69 6e 65 | 64 2e 20 20 53 79 73 74 |n define|d. Syst|
|00000110| 65 6d 20 63 61 6c 6c 73 | 20 6c 69 6b 65 0a 20 63 |em calls| like. c|
|00000120| 6c 6f 73 65 28 29 20 61 | 72 65 20 69 6d 70 6c 65 |lose() a|re imple|
|00000130| 6d 65 6e 74 65 64 20 69 | 6e 20 74 68 65 20 4c 69 |mented i|n the Li|
|00000140| 6e 75 78 20 6c 69 62 63 | 2e 20 20 54 68 69 73 20 |nux libc|. This |
|00000150| 69 6d 70 6c 65 6d 65 6e | 74 61 74 69 6f 6e 20 6f |implemen|tation o|
|00000160| 66 74 65 6e 0a 20 69 6e | 76 6f 6c 76 65 73 20 63 |ften. in|volves c|
|00000170| 61 6c 6c 69 6e 67 20 61 | 20 6d 61 63 72 6f 20 77 |alling a| macro w|
|00000180| 68 69 63 68 20 65 76 65 | 6e 74 75 61 6c 6c 79 20 |hich eve|ntually |
|00000190| 63 61 6c 6c 73 20 73 79 | 73 63 61 6c 6c 28 29 2e |calls sy|scall().|
|000001a0| 20 20 50 61 72 61 6d 65 | 74 65 72 73 0a 20 70 61 | Parame|ters. pa|
|000001b0| 73 73 65 64 20 74 6f 20 | 73 79 73 63 61 6c 6c 28 |ssed to |syscall(|
|000001c0| 29 20 61 72 65 20 74 68 | 65 20 6e 75 6d 62 65 72 |) are th|e number|
|000001d0| 20 6f 66 20 74 68 65 20 | 73 79 73 74 65 6d 20 63 | of the |system c|
|000001e0| 61 6c 6c 20 66 6f 6c 6c | 6f 77 65 64 20 62 79 20 |all foll|owed by |
|000001f0| 74 68 65 0a 20 6e 65 65 | 64 65 64 20 61 72 67 75 |the. nee|ded argu|
|00000200| 6d 65 6e 74 73 2e 20 20 | 54 68 65 20 61 63 74 75 |ments. |The actu|
|00000210| 61 6c 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 20 6e |al syste|m call n|
|00000220| 75 6d 62 65 72 73 20 63 | 61 6e 20 62 65 20 66 6f |umbers c|an be fo|
|00000230| 75 6e 64 20 69 6e 0a 20 | 24 3c 6c 69 6e 75 78 2f |und in. |$<linux/|
|00000240| 75 6e 69 73 74 64 2e 68 | 3e 24 20 77 68 69 6c 65 |unistd.h|>$ while|
|00000250| 20 24 3c 73 79 73 2f 73 | 79 73 63 61 6c 6c 2e 68 | $<sys/s|yscall.h|
|00000260| 3e 24 20 67 65 74 73 20 | 75 70 64 61 74 65 64 20 |>$ gets |updated |
|00000270| 77 69 74 68 20 61 20 6e | 65 77 0a 20 6c 69 62 63 |with a n|ew. libc|
|00000280| 2e 20 20 49 66 20 6e 65 | 77 20 63 61 6c 6c 73 20 |. If ne|w calls |
|00000290| 61 70 70 65 61 72 20 74 | 68 61 74 20 64 6f 6e 27 |appear t|hat don'|
|000002a0| 74 20 68 61 76 65 20 61 | 20 73 74 75 62 20 69 6e |t have a| stub in|
|000002b0| 20 6c 69 62 63 20 79 65 | 74 2c 20 79 6f 75 20 63 | libc ye|t, you c|
|000002c0| 61 6e 0a 20 75 73 65 20 | 73 79 73 63 61 6c 6c 28 |an. use |syscall(|
|000002d0| 29 2e 20 20 41 73 20 61 | 6e 20 65 78 61 6d 70 6c |). As a|n exampl|
|000002e0| 65 2c 20 79 6f 75 20 63 | 61 6e 20 63 6c 6f 73 65 |e, you c|an close|
|000002f0| 20 61 20 66 69 6c 65 20 | 75 73 69 6e 67 20 73 79 | a file |using sy|
|00000300| 73 63 61 6c 6c 28 29 0a | 20 6c 69 6b 65 20 74 68 |scall().| like th|
|00000310| 69 73 20 28 6e 6f 74 20 | 61 64 76 69 73 65 64 29 |is (not |advised)|
|00000320| 3a 0a 0a 5c 62 65 67 69 | 6e 7b 76 65 72 62 61 74 |:..\begi|n{verbat|
|00000330| 69 6d 7d 0a 23 69 6e 63 | 6c 75 64 65 20 3c 73 79 |im}.#inc|lude <sy|
|00000340| 73 63 61 6c 6c 2e 68 3e | 0a 0a 65 78 74 65 72 6e |scall.h>|..extern|
|00000350| 20 69 6e 74 20 73 79 73 | 63 61 6c 6c 28 69 6e 74 | int sys|call(int|
|00000360| 2c 20 2e 2e 2e 29 3b 0a | 0a 69 6e 74 20 6d 79 5f |, ...);.|.int my_|
|00000370| 63 6c 6f 73 65 28 69 6e | 74 20 66 69 6c 65 64 65 |close(in|t filede|
|00000380| 73 63 72 69 70 74 6f 72 | 29 0a 7b 0a 20 20 20 72 |scriptor|).{. r|
|00000390| 65 74 75 72 6e 20 73 79 | 73 63 61 6c 6c 28 53 59 |eturn sy|scall(SY|
|000003a0| 53 5f 63 6c 6f 73 65 2c | 20 66 69 6c 65 64 65 73 |S_close,| filedes|
|000003b0| 63 72 69 70 74 6f 72 29 | 3b 0a 7d 0a 5c 65 6e 64 |criptor)|;.}.\end|
|000003c0| 7b 76 65 72 62 61 74 69 | 6d 7d 0a 0a 20 4f 6e 20 |{verbati|m}.. On |
|000003d0| 74 68 65 20 69 33 38 36 | 20 61 72 63 68 69 74 65 |the i386| archite|
|000003e0| 63 74 75 72 65 2c 20 73 | 79 73 74 65 6d 20 63 61 |cture, s|ystem ca|
|000003f0| 6c 6c 73 20 61 72 65 20 | 6c 69 6d 69 74 65 64 20 |lls are |limited |
|00000400| 74 6f 20 35 20 61 72 67 | 75 6d 65 6e 74 73 0a 20 |to 5 arg|uments. |
|00000410| 62 65 73 69 64 65 73 20 | 74 68 65 20 73 79 73 74 |besides |the syst|
|00000420| 65 6d 20 63 61 6c 6c 20 | 6e 75 6d 62 65 72 20 62 |em call |number b|
|00000430| 65 63 61 75 73 65 20 6f | 66 20 74 68 65 20 6e 75 |ecause o|f the nu|
|00000440| 6d 62 65 72 20 6f 66 20 | 68 61 72 64 77 61 72 65 |mber of |hardware|
|00000450| 0a 20 72 65 67 69 73 74 | 65 72 73 2e 20 20 49 66 |. regist|ers. If|
|00000460| 20 79 6f 75 20 75 73 65 | 20 4c 69 6e 75 78 20 6f | you use| Linux o|
|00000470| 6e 20 61 6e 6f 74 68 65 | 72 20 61 72 63 68 69 74 |n anothe|r archit|
|00000480| 65 63 74 75 72 65 20 79 | 6f 75 20 63 61 6e 20 63 |ecture y|ou can c|
|00000490| 68 65 63 6b 0a 20 24 3c | 61 73 6d 2f 75 6e 69 73 |heck. $<|asm/unis|
|000004a0| 74 64 2e 68 3e 24 20 66 | 6f 72 20 74 68 65 20 5c |td.h>$ f|or the \|
|000004b0| 5f 73 79 73 63 61 6c 6c | 20 6d 61 63 72 6f 73 20 |_syscall| macros |
|000004c0| 74 6f 20 73 65 65 20 68 | 6f 77 20 6d 61 6e 79 20 |to see h|ow many |
|000004d0| 61 72 67 75 6d 65 6e 74 | 73 0a 20 79 6f 75 72 20 |argument|s. your |
|000004e0| 68 61 72 64 77 61 72 65 | 20 73 75 70 70 6f 72 74 |hardware| support|
|000004f0| 73 20 6f 72 20 68 6f 77 | 20 6d 61 6e 79 20 74 68 |s or how| many th|
|00000500| 65 20 64 65 76 65 6c 6f | 70 65 72 73 20 63 68 6f |e develo|pers cho|
|00000510| 73 65 20 74 6f 20 73 75 | 70 70 6f 72 74 2e 0a 20 |se to su|pport.. |
|00000520| 54 68 65 73 65 20 5c 5f | 73 79 73 63 61 6c 6c 20 |These \_|syscall |
|00000530| 6d 61 63 72 6f 73 20 63 | 61 6e 20 62 65 20 75 73 |macros c|an be us|
|00000540| 65 64 20 69 6e 73 74 65 | 61 64 20 6f 66 20 73 79 |ed inste|ad of sy|
|00000550| 73 63 61 6c 6c 28 29 2c | 20 62 75 74 20 74 68 69 |scall(),| but thi|
|00000560| 73 20 69 73 0a 20 6e 6f | 74 20 72 65 63 6f 6d 6d |s is. no|t recomm|
|00000570| 65 6e 64 65 64 20 73 69 | 6e 63 65 20 73 75 63 68 |ended si|nce such|
|00000580| 20 61 20 6d 61 63 72 6f | 20 65 78 70 61 6e 64 73 | a macro| expands|
|00000590| 20 74 6f 20 61 20 66 75 | 6c 6c 20 66 75 6e 63 74 | to a fu|ll funct|
|000005a0| 69 6f 6e 20 77 68 69 63 | 68 0a 20 6d 69 67 68 74 |ion whic|h. might|
|000005b0| 20 61 6c 72 65 61 64 79 | 20 65 78 69 73 74 20 69 | already| exist i|
|000005c0| 6e 20 61 20 6c 69 62 72 | 61 72 79 2e 20 54 68 65 |n a libr|ary. The|
|000005d0| 72 65 66 6f 72 65 2c 20 | 6f 6e 6c 79 20 6b 65 72 |refore, |only ker|
|000005e0| 6e 65 6c 20 68 61 63 6b | 65 72 73 0a 20 73 68 6f |nel hack|ers. sho|
|000005f0| 75 6c 64 20 70 6c 61 79 | 20 77 69 74 68 20 74 68 |uld play| with th|
|00000600| 65 20 5c 5f 73 79 73 63 | 61 6c 6c 20 6d 61 63 72 |e \_sysc|all macr|
|00000610| 6f 73 2e 20 20 54 6f 20 | 64 65 6d 6f 6e 73 74 72 |os. To |demonstr|
|00000620| 61 74 65 2c 20 68 65 72 | 65 20 69 73 20 74 68 65 |ate, her|e is the|
|00000630| 0a 20 63 6c 6f 73 65 28 | 29 20 65 78 61 6d 70 6c |. close(|) exampl|
|00000640| 65 20 75 73 69 6e 67 20 | 61 20 5c 5f 73 79 73 63 |e using |a \_sysc|
|00000650| 61 6c 6c 20 6d 61 63 72 | 6f 2e 0a 0a 5c 62 65 67 |all macr|o...\beg|
|00000660| 69 6e 7b 76 65 72 62 61 | 74 69 6d 7d 0a 23 69 6e |in{verba|tim}.#in|
|00000670| 63 6c 75 64 65 20 3c 6c | 69 6e 75 78 2f 75 6e 69 |clude <l|inux/uni|
|00000680| 73 74 64 2e 68 3e 0a 0a | 5f 73 79 73 63 61 6c 6c |std.h>..|_syscall|
|00000690| 31 28 69 6e 74 2c 20 63 | 6c 6f 73 65 2c 20 69 6e |1(int, c|lose, in|
|000006a0| 74 2c 20 66 69 6c 65 64 | 65 73 63 72 69 70 74 6f |t, filed|escripto|
|000006b0| 72 29 3b 0a 5c 65 6e 64 | 7b 76 65 72 62 61 74 69 |r);.\end|{verbati|
|000006c0| 6d 7d 0a 20 0a 20 54 68 | 65 20 5c 5f 73 79 73 63 |m}. . Th|e \_sysc|
|000006d0| 61 6c 6c 31 20 6d 61 63 | 72 6f 20 65 78 70 61 6e |all1 mac|ro expan|
|000006e0| 64 73 20 72 65 76 65 61 | 6c 69 6e 67 20 74 68 65 |ds revea|ling the|
|000006f0| 20 63 6c 6f 73 65 28 29 | 20 66 75 6e 63 74 69 6f | close()| functio|
|00000700| 6e 2e 20 20 54 68 75 73 | 20 77 65 0a 20 68 61 76 |n. Thus| we. hav|
|00000710| 65 20 63 6c 6f 73 65 28 | 29 20 74 77 69 63 65 2d |e close(|) twice-|
|00000720| 2d 6f 6e 63 65 20 69 6e | 20 6c 69 62 63 20 61 6e |-once in| libc an|
|00000730| 64 20 6f 6e 63 65 20 69 | 6e 20 6f 75 72 20 70 72 |d once i|n our pr|
|00000740| 6f 67 72 61 6d 2e 20 20 | 54 68 65 20 72 65 74 75 |ogram. |The retu|
|00000750| 72 6e 0a 20 76 61 6c 75 | 65 20 6f 66 20 73 79 73 |rn. valu|e of sys|
|00000760| 63 61 6c 6c 28 29 20 6f | 72 20 61 20 5c 5f 73 79 |call() o|r a \_sy|
|00000770| 73 63 61 6c 6c 20 6d 61 | 63 72 6f 20 69 73 20 2d |scall ma|cro is -|
|00000780| 31 20 69 66 20 74 68 65 | 20 73 79 73 74 65 6d 20 |1 if the| system |
|00000790| 63 61 6c 6c 0a 20 66 61 | 69 6c 65 64 20 61 6e 64 |call. fa|iled and|
|000007a0| 20 30 20 6f 72 20 67 72 | 65 61 74 65 72 20 6f 6e | 0 or gr|eater on|
|000007b0| 20 73 75 63 63 65 73 73 | 2e 20 20 54 61 6b 65 20 | success|. Take |
|000007c0| 61 20 6c 6f 6f 6b 20 61 | 74 20 74 68 65 20 67 6c |a look a|t the gl|
|000007d0| 6f 62 61 6c 0a 20 76 61 | 72 69 61 62 6c 65 20 65 |obal. va|riable e|
|000007e0| 72 72 6e 6f 20 74 6f 20 | 73 65 65 20 77 68 61 74 |rrno to |see what|
|000007f0| 20 68 61 70 70 65 6e 65 | 64 20 69 66 20 61 20 73 | happene|d if a s|
|00000800| 79 73 74 65 6d 20 63 61 | 6c 6c 20 66 61 69 6c 65 |ystem ca|ll faile|
|00000810| 64 2e 0a 0a 20 54 68 65 | 20 66 6f 6c 6c 6f 77 69 |d... The| followi|
|00000820| 6e 67 20 73 79 73 74 65 | 6d 20 63 61 6c 6c 73 20 |ng syste|m calls |
|00000830| 74 68 61 74 20 61 72 65 | 20 61 76 61 69 6c 61 62 |that are| availab|
|00000840| 6c 65 20 6f 6e 20 42 53 | 44 20 61 6e 64 20 53 59 |le on BS|D and SY|
|00000850| 53 20 56 20 61 72 65 0a | 20 6e 6f 74 20 61 76 61 |S V are.| not ava|
|00000860| 69 6c 61 62 6c 65 20 6f | 6e 20 4c 69 6e 75 78 3a |ilable o|n Linux:|
|00000870| 20 5c 5c 20 61 75 64 69 | 74 28 29 2c 20 61 75 64 | \\ audi|t(), aud|
|00000880| 69 74 6f 6e 28 29 2c 20 | 61 75 64 69 74 73 76 63 |iton(), |auditsvc|
|00000890| 28 29 2c 20 66 63 68 72 | 6f 6f 74 28 29 2c 0a 20 |(), fchr|oot(),. |
|000008a0| 67 65 74 61 75 69 64 28 | 29 2c 20 67 65 74 64 65 |getauid(|), getde|
|000008b0| 6e 74 73 28 29 2c 20 67 | 65 74 6d 73 67 28 29 2c |nts(), g|etmsg(),|
|000008c0| 20 6d 69 6e 63 6f 72 65 | 28 29 2c 20 70 6f 6c 6c | mincore|(), poll|
|000008d0| 28 29 2c 20 70 75 74 6d | 73 67 28 29 2c 0a 20 73 |(), putm|sg(),. s|
|000008e0| 65 74 61 75 64 69 74 28 | 29 2c 20 73 65 74 61 75 |etaudit(|), setau|
|000008f0| 69 64 28 29 2e 0a 0a 5c | 65 6e 64 69 6e 70 75 74 |id()...\|endinput|
|00000900| 0a | |. | |
+--------+-------------------------+-------------------------+--------+--------+